<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CRM客户端</title>
    <link rel="stylesheet" href="../bs引用文件/css/bootstrap.min.css">
    <script type="text/javascript" src="../bs引用文件/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/bootstrap-filestyle.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/jquery.validate.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/additional-methods.js"></script>
    <script type="text/javascript" src="../bs引用文件/js/messages_zh.js"></script>
    <link rel="stylesheet" href="../bs引用文件/bootstrap3-editable/css/bootstrap-editable.css">
    <script type="text/javascript" src="../bs引用文件/bootstrap3-editable/js/bootstrap-editable.js"></script>
    <style type="text/css">
        input.error{
            border-color: #aa1111;
            border-style: solid;
            border-width:2px;
        }
        label.error{
            color: red;
        }
    </style>
</head>
<body style="background-color: rgba(122, 176, 208, 0.15);">
<?php
//存变量


session_start();
@$admin=$_SESSION["ZH"];
if (!empty($admin)){
$pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
$useNamed=$pdo->prepare('select * from customerLogin where adm=:aa');
$useNamed->execute(array('aa'=>$admin));
$dataNamed=$useNamed->fetchAll(PDO::FETCH_NAMED);
$card=@$dataNamed[0][idcard];
$born=substr($card,6,8);
$bYear=substr($born,0,4);$bMonth=substr($born,4,2);$bDate=substr($born,6,2);
?>
 <!--导航条-->
      <div class="container" style="border-radius: 25px; background: rgba(64, 109, 171, 0.2);height: 37px;">
          <div style="font-size: 150%;color: rgba(120, 80, 97, 0.72);" class="col-xs-5">
              [-<span style="color: #0000cc;"><?php echo @$dataNamed[0][named]; ?></span>-]你好，欢迎回来
          </div>
          <div style="text-align: right;font-size: 150%;color: #ac2925;" class="col-xs-7">
             <a href="Ctcdl.php">退出</a>
          </div>
      </div>
    <br/>
<!--导航条-->
  <div class="container">
    <div class="row">
        <div class="col-xs-2">
             <div style="border-radius: 15px;background-color: #a6e1ec;padding: 10px;width: 100%;text-align: center;font-size:120%;">
                <a id="information">信息查询</a>
             </div><br/>
             <div style="border-radius: 15px;background-color: #a6e1ec;padding: 10px;width: 100%;text-align: center;font-size:120%;">
                 <a id="searchbusiness">业务查询</a>
              </div><br/>
             <div style="border-radius: 15px;background-color: #a6e1ec;padding: 10px;width: 100%;text-align: center;font-size:120%;">
                 <a id="dealbusiness">业务办理</a>
             </div><br/>
        </div>
        <div class="col-xs-10">
             <!--客户信息-->
              <div class="row" width="100%" id="kehuxinxi">
                  <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                      <div class="panel panel-primary">
                          <div class="panel-heading" role="tab" id="headingOne">
                              <div class="panel-title">
                                  <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                      基本资料
                                  </a>
                                  <span style="float: right">
                                      <button type="button" class="btn btn-info glyphicon btn-sm glyphicon-edit" style="position: relative;top:-5px;" data-toggle="modal" data-target="#editorJbxx">修改</button>
                                  </span>
                              </div>
                          </div>
                          <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                              <div class="panel-body">
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">姓名：</div>
                                      <div class="col-xs-7"><?php echo @$dataNamed[0][named]; ?></div>
                                  </div><br/>
                                 <div class="row" width="100%">
                                     <div class="col-xs-2">电话：</div>
                                     <div class="col-xs-7"><?php echo @$dataNamed[0][tel]; ?></div>
                                 </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">QQ：</div>
                                      <div class="col-xs-7"><?php echo @$dataNamed[0][QQ]; ?></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">邮箱：</div>
                                      <div class="col-xs-7"><?php echo @$dataNamed[0][email]; ?></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">身份证：</div>
                                      <div class="col-xs-7"><?php echo @$dataNamed[0][idcard]; ?></div>
                                  </div>
                              </div>
                          </div>
                      </div>
                      <div class="panel panel-info">
                          <div class="panel-heading" role="tab" id="headingTwo">
                              <div class="panel-title">
                                  <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
                                      详细资料
                                  </a>
                              </div>
                          </div>
                          <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
                              <div class="panel-body">
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">出生日期：</div>
                                      <div class="col-xs-7"><?php echo $bYear; ?><span>年</span><?php echo $bMonth; ?><span>月</span><?php echo $bDate; ?><span>日</span></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">性别：</div>
                                      <div class="col-xs-7"><a href="#" id="sex"><?php echo @$dataNamed[0][sex]; ?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">籍贯：</div>
                                      <div class="col-xs-7"><a href="#" id="jiguan"><?php echo @$dataNamed[0][jiguan];?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">住址：</div>
                                      <div class="col-xs-7"><a href="#" id="address"><?php echo @$dataNamed[0][address]; ?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">最高学历：</div>
                                      <div class="col-xs-7"><a href="#" id="diploma"><?php echo @$dataNamed[0][diploma]; ?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">婚否：</div>
                                      <div class="col-xs-7"><a href="#" id="marry"><?php echo @$dataNamed[0][marry]; ?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">现所在单位：</div>
                                      <div class="col-xs-7"><a href="#" id="unit"><?php echo @$dataNamed[0][unit]; ?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">从事的工作：</div>
                                      <div class="col-xs-7"><a href="#" id="towork"><?php echo @$dataNamed[0][towork]; ?></a></div>
                                  </div><br/>
                                  <div class="row" width="100%">
                                      <div class="col-xs-2">兴趣爱好：</div>
                                      <div class="col-xs-7"><a href="#" id="interest"><?php echo @$dataNamed[0][interest]; ?></a></div>
                                  </div><br/>
                              </div>
                          </div>
                      </div>

                      <div class="panel panel-info">
                          <div class="panel-heading" role="tab" id="headingThree">
                              <div class="panel-title">
                                  <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
                                      信息中心
                                  </a>
                              </div>
                          </div>
                          <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
                              <div class="panel-body">
                                <div width="100%" style="font-size: larger;text-align: center;">消息记录</div>
                                  <table class="table table-bordered">
                                      <tr>
                                          <th>#</th><th style="text-align: center">发送人</th><th style="text-align: center">标题(点击查看)</th><th style="text-align: center">收信时间</th><th></th>
                                      </tr>
                                      <?php
                                      $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
                                      $useXX=$pdo->prepare('select ctmXiaoxi.reciveTime,ctmXiaoxi.id,ctmXiaoxi.title,ctmXiaoxi.neirong,ctmXiaoxi.who from ctmXiaoxi left join customerLogin on ctmXiaoxi.loginId=customerLogin.id where customerLogin.adm=:xxadm');
                                      $useXX->execute(array('xxadm'=>$admin));
                                      $dataXX=$useXX->fetchAll(PDO::FETCH_NAMED);
                                      if(!empty($dataXX)){
                                            $i=1;
                                         foreach($dataXX as $key=>$value){
                                             echo "<tr>";echo '<td>'.$i.'</td>' ;
                                             ?>
                                               <td><?php echo @$value[who];?></td>
                                               <td><a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo @$value[neirong];?>"><?php echo @$value[title];?></a></td>
                                               <td><?php echo @$value[reciveTime];?></td>
                                             <td><a id="sc<?php echo @$value[id];?>">删除</a></td>
                                               <script>
                                                   $("#sc<?php echo @$value[id];?>").click(function(){
                                                       var r=confirm("确定要删除该条消息吗")
                                                       if(r==true){
                                                           location.href="deleteXiaoXi.php?xxid=<?php echo @$value[id];?>";
                                                       }
                                                   });
                                               </script>
                                             <?php
                                             echo "</tr>";$i++;
                                         }
                                      }
                                      ?>
                                  </table>
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
             <!--客户信息-->

            <!--业务办理-->
            <div class="row" width="100%" id="yewubanli" style="display: none;">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        业务办理
                    </div>
                    <div class="panel-body">
                        <table class="table table-bordered">
                           <tr>
                               <th class="col-xs-1">#</th>
                               <th style="text-align: center" class="col-xs-2">业务名(<span style="color: #221199;font-size: smaller;">点击查看介绍</span>)</th>
                               <th style="text-align: center" class="col-xs-4">价格</th>
                               <th class="col-xs-4" style="text-align: center">
                                   <div>有效时间</div>
                                   <div style="text-align: center;">
                                       <div class="input-group-btn">
                                           <div class="btn-group" role="group">
                                               <button type="submit" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                   <span id="selTimeBtn">选择时间</span><span class="caret"></span>
                                               </button>
                                               <ul class="dropdown-menu dropdown-menu-right">
                                                   <li><a id="XZSJquanbu">全部</a></li>
                                                   <?php
                                                   $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
                                                   $dishtype=$pdo->prepare('select distinct youxiaoTime from yewuType;');
                                                   $okma=$dishtype->execute();
                                                   if($okma){
                                                       $dtresult=$dishtype->fetchAll(PDO::FETCH_NAMED);
                                                       foreach($dtresult as $key=>$value){
                                                           ?>
                                                           <li><a><?php echo @$value[youxiaoTime];?></a></li>
                                                           <?php
                                                       }
                                                   }
                                                   ?>
                                               </ul>
                                           </div>
                                       </div>
                                   </div>
                                   <script>
                                       $(document).ready(function(){


                                       });
                                   </script>
                               </th>
                               <th class="col-xs-1"></th>
                           </tr>
                               <?php
                               $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');

                               $useYW=$pdo->prepare('select * from yewuType order by name');
                               $useYW->execute();

                               $dataYW=$useYW->fetchAll(PDO::FETCH_NAMED);
                               if(!empty($dataYW)){
                                   $j=1;
                                   foreach($dataYW as $key=>$value){
                                       echo "<tr>";echo '<td>'.$j.'</td>' ;
                                       ?>
                                        <td><a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo @$value[jianjie];?>"><?php echo @$value[name];?></a></td>
                                        <td><?php echo @$value[price];?></td>
                                        <td><?php echo @$value[youxiaoTime];?></td>
                                        <td><a>申请</a></td>
                                       <?php
                                       echo "</tr>";$j++;
                                   }
                               }
                               ?>
                        </table>
                    </div>
                </div>
            </div>
            <!--业务办理-->

            <!--业务查询-->
             <div class="row" id="yewuchaxun"  style="display:none;">
                 <div class="panel panel-primary">
                     <div class="panel-heading">
                         业务查询
                     </div>
                     <div class="panel-body">
                         <table class="table table-bordered">
                           <tr>
                               <th class="col-xs-1">#</th>
                               <th style="text-align: center" class="col-xs-2">业务名</th>
                               <th style="text-align: center" class="col-xs-3">价格/有效时间</th>
                               <th style="text-align: center" class="col-xs-2">状态</th>
                               <th style="text-align: center" class="col-xs-3">生效时间</th>
                               <th class="col-xs-1"></th>
                           </tr>
                             <?php
                             $pdo=new PDO('mysql:dbname=shuju;charset=utf8','root');
                             $useYWCX=$pdo->prepare('select ctmYewuRec.id,ctmYewuRec.yewuName,ctmYewuRec.yewuPrice,ctmYewuRec.YXtime,ctmYewuRec.state,ctmYewuRec.starTime from ctmYewuRec join customerLogin on ctmYewuRec.loginId=customerLogin.id where customerLogin.adm=:abc order by ctmYewuRec.starTime desc');
                             $useYWCX->execute(array('abc'=>$admin));
                             $dataYWCX=$useYWCX->fetchAll(PDO::FETCH_NAMED);
                             if(!empty($dataYWCX)){
                                 $ij=1;
                                 foreach($dataYWCX as $key=>$value){
                                     echo "<tr>";echo '<td>'.$ij.'</td>' ;
                                     ?>
                                     <td><?php echo @$value[yewuName];?></td>
                                     <td><?php echo @$value[yewuPrice];?>&nbsp;/&nbsp;<?php echo @$value[YXtime];?></td>
                                     <td><?php echo @$value[state];?></td>
                                     <td><?php echo @$value[starTime];?></td>
                                     <td><a id="scRc<?php echo @$value[id];?>">删除</a></td>
                                     <script>
                                         $("#scRc<?php echo @$value[id];?>").click(function(){
                                             var r=confirm("确定要删除该条消息吗")
                                             if(r==true){
                                                 location.href="deleteXiaoXi.php?scRcid=<?php echo @$value[id];?>";
                                             }
                                         });
                                     </script>
                                     <?php
                                     echo "</tr>";$ij++;
                                 }
                             }
                             ?>
                         </table>
                     </div>
             </div>
            <!--业务查询-->
        </div>
    </div>
  </div>

<!--修改详细信息-->
<script>
    $(document).ready(function(){
        $('#towork').editable({
            type:'text',
            pk:1,
            mode: 'inline',
            url: 'editor.php',
            placeholder:'当前具体工作'
        });
        $('#unit').editable({
            type:'text',
            pk:2,
            mode: 'popup',
            url: 'editor.php',
            title:"单位名称",
            highlight:'green'
        });
        $('#sex').editable({
            type:'select',
            pk:3,
            mode: 'popup',
            url: 'editor.php',
            title:"请选择性别",
            highlight:'blue',
            value:'保密',
            source: [
                {value:'男', text: '男'},
                {value:'女', text: '女'},
                {value:'保密', text: '保密'}
            ]
        });
        $('#diploma').editable({
            type:'select',
            pk:4,
            mode: 'popup',
            url: 'editor.php',
            title:"请选择最高学历",
            highlight:'#921AFF',
            value:'无',
            source: [
                {value:'本科', text: '本科'},
                {value:'专科', text: '专科'},
                {value:'高中', text: '高中'},
                {value:'初中', text: '初中'},
                {value:'小学', text: '小学'},
                {value:'无', text: '无'}
            ]
        });
        $('#marry').editable({
            type:'select',
            pk:5,
            mode: 'inline',
            url: 'editor.php',
            highlight:' #D200D2',
            value:'保密',
            source: [
                {value:'已婚', text: '已婚'},
                {value:'未婚', text: '未婚'},
                {value:'保密', text: '保密'}
            ]
        });
        $('#address').editable({
            type:'textarea',
            pk:6,
            mode: 'popup',
            title:'居住地址',
            url: 'editor.php',
            highlight:'#CCFF80',
            placeholder:'户口所在地址'
        });
        $('#jiguan').editable({
            type:'text',
            pk:7,
            mode: 'popup',
            title:'籍贯',
            url: 'editor.php',
            highlight:'#CCFF80'
        });
        $('#interest').editable({
            type:'checklist',
            pk:8,
            mode: 'popup',
            title:'特长',
            url: 'editor.php',
            highlight:'#CCFF80',
            source: [
                {value: '篮球', text: '篮球'},
                {value: '足球', text: '足球'},
                {value: '室内球类', text: '室内球类'},
                {value: '打锤', text: '打锤'},
                {value: '绊筋', text: '绊筋'},
                {value: '跑步', text: '跑步'},
                {value: '其他', text: '其他'}
            ]
        });
    });
</script>

<!--修改基本信息模态框-->
      <div class="modal fade" id="editorJbxx" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
          <div class="modal-dialog" role="document">
              <div class="modal-content">
                  <div class="modal-body">
                      <form class="form-horizontal" method="post" action="editor.php" id="form1">
                          <div class="form-group">
                              <label for="xingming1" class="col-xs-3 control-label">姓名：</label>
                              <div class="col-xs-6">
                                  <input type="text" class="form-control" id="xingming1" name="xingming1"
                                      value="<?php echo @$dataNamed[0][named]; ?>" required="required">
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="dianhua1" class="col-xs-3 control-label">电话：</label>
                              <div class="col-xs-6">
                                  <input type="text" class="form-control" id="dianhua1" name="dianhua1"
                                         value="<?php echo @$dataNamed[0][tel]; ?>" required="required">
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="QQ1" class="col-xs-3 control-label">Q Q：</label>
                              <div class="col-xs-6">
                                  <input type="text" class="form-control" id="QQ1" name="QQ1"
                                         value="<?php echo @$dataNamed[0][QQ]; ?>" required="required">
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="email1" class="col-xs-3 control-label">邮箱：</label>
                              <div class="col-xs-6">
                                  <input type="text" class="form-control" id="email1" name="email1"
                                         value="<?php echo @$dataNamed[0][email]; ?>" required="required">
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="idcard1" class="col-xs-3 control-label">身份证：</label>
                              <div class="col-xs-6">
                                  <input type="text" class="form-control" id="idcard1" name="idcard1"
                                         value="<?php echo @$dataNamed[0][idcard]; ?>" required="required">
                              </div>
                          </div>
                           <input type="text" value="xgjbxx" style="display: none" name="xgjbxx">
                            <button type="submit" class="btn btn-info col-xs-offset-3">确定修改</button>
                      </form>
                  </div>
                  <div class="modal-footer">
                      <button type="button" class="btn btn-warning" data-dismiss="modal" id="quxiaoxiegai">取消</button>
                  </div>
              </div>
          </div>
      </div>
      <script>
          $(document).ready(function() {
              $("#quxiaoxiegai").click(function(){
                  $("#xingming1").val('<?php echo @$dataNamed[0][named]; ?>');$("#dianhua1").val('<?php echo @$dataNamed[0][tel]; ?>');
                  $("#QQ1").val('<?php echo @$dataNamed[0][QQ]; ?>');$("#email1").val('<?php echo @$dataNamed[0][email]; ?>');
                  $("#idcard1").val('<?php echo @$dataNamed[0][idcard]; ?>');
              });
              $.validator.addMethod("checktel",function(value,element){
                  var num=parseInt(value);
                  if(num.toString().length==11){
                      return this.optional(element) || (/^1[3|4|5|8][0-9]\d{4,8}$/.test(value));
                  }else{
                      return false;
                  }
              },"✘请输入正确的手机号码");
              $("#form1").validate({
                  rules:{
                      dianhua1:{
                          checktel:true
                      },
                      email1:{
                          email:true
                      },
                      idcard1:{
                          range:[110000195001010001,890000200001010001]
                      },
                      QQ1:{
                          rangelength:[5,11]
                      }
                  },
                  messages:{
                      idcard1:{
                          range:"✘请输入有效身份证"
                      },
                      QQ1:{
                          rangelength:"输入无效"
                      }
                  }
              });
          });
      </script>
<?php
}else{
?>
<div class="modal-dialog">
    <div class="modal-content" style="
        background: -webkit-radial-gradient(red, green, rgba(120, 121, 255, 0.64));
         background: -o-radial-gradient(red, green, rgba(120, 121, 255, 0.64));
        background: -moz-radial-gradient(red, green,rgba(120, 121, 255, 0.64));
         background: radial-gradient(red, green, rgba(120, 121, 255, 0.64));
                     ">
        <div class="modal-header">
            <h3>消息</h3>
        </div>
        <div class="modal-body">
            <p>请登录后访问...</p>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-primary">
                <a href="../index.php" style="color:white;">确定</a>
            </button>
        </div>
    </div>
</div>
<?php
}
?>
<script>
    //信息业务切换
    $('#information').click(function(){
        $("#kehuxinxi").show(); $("#yewubanli").hide(); $("#yewuchaxun").hide();
    });
    $('#searchbusiness').click(function(){
        $("#kehuxinxi").hide(); $("#yewubanli").hide(); $("#yewuchaxun").show();
    });
    $('#dealbusiness').click(function(){
        $("#kehuxinxi").hide(); $("#yewubanli").show(); $("#yewuchaxun").hide();
    });
</script>
      <!--弹出框初始化-->
      <script>
          $('[data-toggle="popover"]').popover();
      </script>
</body>
</html>